<?php

namespace app\api\model;

use think\Model;

class ShopFreight extends Model
{
    //计算运费  根据运费规则Ids + 订单金额  => 运费金额
    public static function getPrice($ids,$total)
    {
        $fPrice = 0;
        $freights = self::where('id','in',$ids)->select();
        foreach ($freights as $freight) {
            if($freight['ceiling_price'] > $total){
                $fPrice +=$freight['freight_price'];
            }
        }
        return $fPrice;
    }
}
